package com.lizhen.createpattern.abstractfactorypattern.impl;

import com.lizhen.createpattern.abstractfactorypattern.AbstractFactory;
import com.lizhen.createpattern.abstractfactorypattern.Color;
import com.lizhen.createpattern.abstractfactorypattern.Shape;

public class ColorFactory extends AbstractFactory {
    public ColorFactory() {
    }

    protected Shape getShape(String shapeType) {
        return null;
    }

    protected Color getColor(String color) {
        if (color == null) {
            return null;
        } else if (color.equalsIgnoreCase("RED")) {
            return new Red();
        } else if (color.equalsIgnoreCase("GREEN")) {
            return new Green();
        } else {
            return color.equalsIgnoreCase("BLUE") ? new Blue() : null;
        }
    }
}
